home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Directorty Opus 5 - Magellan 2
/
Opus 5 - Magellan 2.iso
/
Archiv
/
Install_3.3.lha
/
Install_3.3
/
ARexx
/
Install_Main.dopus5
< prev
next >
Wrap
Text File
|
1997-06-01
|
20KB
|
721 lines
/* $VER: Install_Main.dopus5 3.2 (01.06.97) © Frédéric Steinfels
*/
signal on BREAK_C
signal on BREAK_D
signal on BREAK_E
signal on BREAK_F
signal on HALT
signal on IOERR
signal on SYNTAX
signal on FAILURE
options failat 21
options results
parse arg arguments
Call Init
address value PORT
lister query srch path
srcp=result
lister query dsth path
dstp=result
if ~open(prefs,PREFSFILE,'READ') then do
dopus request '"' || GetCatStr(18,'Error in') ProgramName || lf || GetCatStr(15,'Unable to open') PREFSFILE || '"' GetCatStr(0,'Abort')
call CleanUP
Exit
end
ln=readln(prefs)
Call Close(prefs)
cnt=1
do while cnt<15
s.cnt=substr(ln,cnt,1)
if s.cnt~=0 & s.cnt~=1 then do
dopus request '"' || GetCatStr(18,'Error in') ProgramName || lf || GetCatStr(31,'Error while reading') PREFSFILE || '"' GetCatStr(0,'Abort')
call CleanUP
Exit
end
cnt=cnt+1
end
drop ln
if s.10=0 & s.11=0 & s.12=0 & s.14=0 & (s.5~=0 | s.6~=0) then do
dopus request '"' || GetCatStr(18,'Error in') ProgramName || lf || GetCatStr(32,'You must set more compare criteriums') || '"' GetCatStr(0,'Abort')
call CleanUP
Exit
end
MYPORT='DOINMN.'||prgcnt
SSPORT='DOINSS.'||prgcnt
SDPORT='DOINSD.'||prgcnt
VSPORT='DOINVS.'||prgcnt
VDPORT='DOINVD.'||prgcnt
RQPORT='DOINRQ.'||prgcnt
EXPORT='DOINEX.'||prgcnt
SPORT.1=SSPORT
SPORT.2=SDPORT
VPORT.1=VSPORT
VPORT.2=VDPORT
MYID=0
ID=''
CMD=''
ARG=''
/* ID CMD
0 Main Program
0 abort
1 Source Scanner
0 abort
1 Directory
2 File
3 Directory complete
2 Destination Scanner
0 abort
1 Directory
2 File
3 Directory complete
3 Source CRC and Version scanner
0 abort
4 Destination CRC and Version scanner
0 abort
5 Requester
0 abort
1 Auot replace, destination file is delete protected
2 Auto replace, source file is delete protected
3 Standard requester
4 Requester without 'repl Source'
5 Requester without 'repl Dest'
6 Auto replace, Requester without 'repl Source' and destination file is delete protected
7 Auto replace, Requester without 'repl Dest' and source file is delete protected
8 Both files are delete protected
6 Executor
0 abort
*/
src=1
dst=2
MYPORTH=openport(MYPORT)
ADDRESS 'AREXX' 'DOpus5:ARexx/Install_Scan.dopus5' PORT MYPORT SSPORT 1 SRCH '"' || SRCP || '"'
ADDRESS 'AREXX' 'DOpus5:ARexx/Install_Scan.dopus5' PORT MYPORT SDPORT 2 DSTH '"' || DSTP || '"'
if s.1=1 then do
ADDRESS 'AREXX' 'DOpus5:ARexx/Install_GetID.dopus5' PORT MYPORT VSPORT 3 WRITECOM '"' || SRCP || '"'
end
else do
ADDRESS 'AREXX' 'DOpus5:ARexx/Install_GetID.dopus5' PORT MYPORT VSPORT 3 '"' || SRCP || '"'
end
if s.2=1 then do
ADDRESS 'AREXX' 'DOpus5:ARexx/Install_GetID.dopus5' PORT MYPORT VDPORT 4 WRITECOM '"' || DSTP || '"'
end
else do
ADDRESS 'AREXX' 'DOpus5:ARexx/Install_GetID.dopus5' PORT MYPORT VDPORT 4 '"' || DSTP || '"'
end
ADDRESS 'AREXX' 'DOpus5:ARexx/Install_Execute.dopus5' PORT MYPORT EXPORT 5 '"' || SRCP || '"' '"' || DSTP || '"'
ADDRESS 'AREXX' 'DOpus5:ARexx/Install_Request.dopus5' PORT MYPORT EXPORT RQPORT 6 '"' || SRCP || '"' '"' || DSTP || '"'
Call WriteCh('CON',GetCatStr(56,'Waiting for subtasks') || ' ')
do while POS(SSPORT,SHOW('p'))=0 | POS(SDPORT,SHOW('p'))=0 | POS(VSPORT,SHOW('p'))=0 | POS(VDPORT,SHOW('p'))=0 | POS(RQPORT,SHOW('p'))=0 | POS(EXPORT,SHOW('p'))=0
Call WriteCh('CON','.')
Call delay(5)
end
Call WriteLn('CON',' ' || GetCatStr(57,'ready'))
Call WriteLn('CON',GetCatStr(33,'Initialized with portname') MYPORT)
cntp=1
cntf=0
p.path.cntp=''
last.src=1
last.dst=1
idfiles=0
reqfiles=0
do until CMD='0'
call waitpkt(MYPORT)
Packet=getpkt(MYPORT)
if Packet ~= null() then do
ln = getarg(Packet,0)
ID=substr(ln,1,1)
CMD=substr(ln,2,1)
ARG=substr(ln,3)
call CheckArg
IF ID=1 | ID=2 THEN DO
IF CMD=1 THEN DO
parse var arg path2 '0a'x nump
Call NewDir
end
IF CMD=2 THEN DO
parse var arg name2 '0a'x nump '0a'x size2 '0a'x fdate2 '0a'x com2
Call NewFile
end
IF CMD=3 THEN DO
parse var arg nump
Call DirComplete
end
end
IF ID=3 | ID=4 THEN DO
IF CMD=1 THEN DO
parse var arg name2 '0a'x ps '0a'x com2
Call UpdateFile
idfiles=idfiles-1
if idfiles=0 then do
Call CheckEnd
end
end
end
IF ID=6 THEN DO
IF CMD>0 THEN DO
parse var arg ps
nump=f.path.ps
IF CMD=1 THEN DO
say GetCatStr(34,'[REPL D]') makepath(p.path.nump,f.name.ps)
end
IF CMD=2 THEN DO
say GetCatStr(35,'[REPL S]') makepath(p.path.nump,f.name.ps)
end
IF CMD=3 THEN DO
say GetCatStr(36,'[SKIP A]') makepath(p.path.nump,f.name.ps)
end
Call DropFile
reqfiles=reqfiles-1
if reqfiles=0 then do
Call CheckEnd
end
end
end
end
end
Call CleanUP
exit
DirComplete: /* Directory variables are not dropped yet */
if nump=last.ID then do
dopus send SPORT.ID MYID || 2
last.ID='END'
call CheckEnd
end
return
CheckEnd:
if last.1='END' & last.2='END' & idfiles=0 & reqfiles=0 then do
Call CleanUP
exit
end
return
UpdateFile:
if f.1.ok.ps=2 | f.2.ok.ps=2 then return
ID=ID-2
fdate2=f.ID.fdate.ps
call ParseComment
f.ID.crc.ps=crc2
f.ID.vdate.ps=vdate2
f.ID.base.ps=base2
f.ID.ver.ps=ver2
f.ID.rev.ps=rev2
f.ID.info.ps=info2
f.ID.com.ps=com3
Call CheckComplete
ID=ID+2
return
NewFile:
if symbol('lf.nump.0')='LIT' then do
lf.nump.0=0
end
p2=LSEARCH(name2,lf.nump)
if p2=-1 then do
cntf=cntf+1
ps=cntf
p2=(lf.nump.0)+1
lf.nump.0=p2
lf.nump.p2=name2
lf.nump.p2.num=ps
end
else do
ps=lf.nump.p2.num
end
if f.1.ok.ps=2 | f.2.ok.ps=2 then do
Call DropFile
return
end
call ParseComment
f.name.ps=name2
f.path.ps=nump
f.ID.crc.ps=crc2
f.ID.fdate.ps=fdate2
f.ID.vdate.ps=vdate2
f.ID.size.ps=size2
f.ID.base.ps=base2
f.ID.ver.ps=ver2
f.ID.rev.ps=rev2
f.ID.info.ps=info2
f.ID.com.ps=com3
if cdate2~=fdate2 then do
dopus send VPORT.ID MYID || 1 || p.path.nump || lf || name2 || lf || ps || lf || fdate2 || lf || com3
idfiles=idfiles+1
end
else do
Call CheckComplete
end
Return
NewDir:
path2=makepath(p.path.nump,path2)
if symbol('lp.nump.0')='LIT' then do
lp.nump.0=0
end
p2=LSEARCH(path2,lp.nump)
if p2=-1 then do
cntp=cntp+1
ps=cntp
p2=(lp.nump.0)+1
lp.nump.0=p2
lp.nump.p2=path2
lp.nump.p2.num=ps
end
else do
ps=lp.nump.p2.num
end
/*p.path.0=cntp
ps=LSEARCH(path2,p.path)
IF ps=-1 then do
cntp=cntp+1
ps=cntp
end*/
p.path.ps=path2
last.ID=ps
dopus send SPORT.ID MYID || 1 || path2 || lf || ps
return
CheckComplete:
nump=f.path.ps
if ID=1 then do
f.1.ok.ps=1
if f.2.ok.ps=1 then do
Call CompareFiles
f.1.ok.ps=2
f.2.ok.ps=2
end
else do
if ~exists(makepath(makepath(dstp,p.path.nump),name2)) then do
Call CompareFiles
f.1.ok.ps=2
f.2.ok.ps=2
end
end
end
if ID=2 then do
f.2.ok.ps=1
if f.1.ok.ps=1 then do
Call CompareFiles
f.1.ok.ps=2
f.2.ok.ps=2
end
else do
if ~exists(makepath(makepath(srcp,p.path.nump),name2)) then do
Call CompareFiles
f.1.ok.ps=2
f.2.ok.ps=2
end
end
end
return
CompareFiles:
/* Copy file to Destination ? */
if f.1.ok.ps=1 & f.2.ok.ps~=1 then do
if s.8=1 then do
dopus send EXPORT MYID || 1 || p.path.nump || lf || name2
say GetCatStr(37,'[COPY D]') makepath(p.path.nump,name2)
/* Call DropFile */
return
end
else do
say GetCatStr(38,'[SKIP D]') makepath(p.path.nump,name2)
Call DropFile
return
end
end
/* Copy file to Source ? */
if f.1.ok.ps~=1 & f.2.ok.ps=1 then do
if s.7=1 then do
dopus send EXPORT MYID || 2 || p.path.nump || lf || name2
say GetCatStr(39,'[COPY S]') makepath(p.path.nump,name2)
/* Call DropFile */
return
end
else do
say GetCatStr(40,'[SKIP S]') makepath(p.path.nump,name2)
Call DropFile
return
end
end
/* Both file exist ? */
if f.1.ok.ps=1 & f.2.ok.ps=1 then do
if symbol('f.1.fdate.ps')='LIT' then do
if open('win','CON:280/183/747/370/SHELL/CLOSE/SHOWDIR/WAIT','WRITE') then do
Call writech('win',1 || lf || ps || lf || f.1.ok.ps || lf || p.path.nump || lf || name2 || lf || f.1.fdate.ps || lf || f.2.fdate.ps || lf || f.1.vdate.ps || lf || f.2.vdate.ps || lf || f.1.size.ps || lf || f.2.size.ps || lf || f.1.base.ps || lf || f.2.base.ps || lf || f.1.ver.ps || lf || f.2.ver.ps || lf || f.1.rev.ps || lf || f.2.rev.ps || lf || f.1.info.ps || lf || f.2.info.ps || lf || f.1.com.ps || lf || f.2.com.ps)
end
Call Close('win')
end
if symbol('f.2.fdate.ps')='LIT' then do
if open('win','CON:280/183/747/370/SHELL/CLOSE/SHOWDIR/WAIT','WRITE') then do
Call writech('win',2 || lf || ps || lf || f.1.ok.ps || lf || p.path.nump || lf || name2 || lf || f.1.fdate.ps || lf || f.2.fdate.ps || lf || f.1.vdate.ps || lf || f.2.vdate.ps || lf || f.1.size.ps || lf || f.2.size.ps || lf || f.1.base.ps || lf || f.2.base.ps || lf || f.1.ver.ps || lf || f.2.ver.ps || lf || f.1.rev.ps || lf || f.2.rev.ps || lf || f.1.info.ps || lf || f.2.info.ps || lf || f.1.com.ps || lf || f.2.com.ps)
end
Call Close('win')
end
/* equal ? */
if f.1.crc.ps=f.2.crc.ps & f.1.size.ps=f.2.size.ps then do
say GetCatStr(41,'[SKIP= ]') makepath(p.path.nump,name2)
Call DropFile
return /* skip file */
end
/* is it an icon */
if UPPER(right(name2,5))='.INFO' then do
/* icon compare enabled ? */
if s.9=1 then do
say GetCatStr(42,'[SKIP.e]') makepath(p.path.nump,name2)
Call DropFile
return /* icon compare routine not implemented yet */
end
else do
say GetCatStr(43,'[SKIP. ]') makepath(p.path.nump,name2)
Call DropFile
return
end
end
/* both file exist but replacing disabled ? */
if s.3=0 & s.4=0 then do
say GetCatStr(44,'[SKIPnr]') makepath(p.path.nump,name2)
Call DropFile
return
end
/* Overwrite the file on Destination ? */
if s.4=1 then do /* replace */
if s.6=1 then do /* auto replace */
if (f.1.base.ps=f.2.base.ps | s.13=0) & ((f.1.fdate.ps>f.2.fdate.ps) | s.11=0) & ((f.1.vdate.ps>f.2.vdate.ps) | s.12=0) & ((f.1.size.ps>f.2.size.ps) | s.10=0) & ((f.1.ver.ps>f.2.ver.ps | (f.1.ver.ps=f.2.ver.ps & f.1.rev.ps>f.2.rev.ps)) | s.14=0) then do
if delete(makepath(makepath(dstp,p.path.nump),name2)) then do
dopus send EXPORT MYID || 1 || p.path.nump || lf || name2
say GetCatStr(34,'[REPL D]') makepath(p.path.nump,name2)
Call DropFile
return
end
else do
reqfiles=reqfiles+1
if s.3=1 then do
dopus send RQPORT MYID || 1 || p.path.nump || lf || name2 || lf || f.1.fdate.ps || lf || f.2.fdate.ps || lf || f.1.vdate.ps || lf || f.2.vdate.ps || lf || f.1.size.ps || lf || f.2.size.ps || lf || f.1.base.ps || lf || f.2.base.ps || lf || f.1.ver.ps || lf || f.2.ver.ps || lf || f.1.rev.ps || lf || f.2.rev.ps || lf || f.1.info.ps || lf || f.2.info.ps || lf || f.1.com.ps || lf || f.2.com.ps || lf || ps
end
else do
dopus send RQPORT MYID || 6 || p.path.nump || lf || name2 || lf || f.1.fdate.ps || lf || f.2.fdate.ps || lf || f.1.vdate.ps || lf || f.2.vdate.ps || lf || f.1.size.ps || lf || f.2.size.ps || lf || f.1.base.ps || lf || f.2.base.ps || lf || f.1.ver.ps || lf || f.2.ver.ps || lf || f.1.rev.ps || lf || f.2.rev.ps || lf || f.1.info.ps || lf || f.2.info.ps || lf || f.1.com.ps || lf || f.2.com.ps || lf || ps
end
say GetCatStr(45,'[ASKe D]') makepath(p.path.nump,name2)
return
end
end
end
end
/* Overwrite the file on Source ? */
if s.3=1 then do /* replace */
if s.5=1 then do /* auto replace */
if (f.1.base.ps=f.2.base.ps | s.13=0) & ((f.2.fdate.ps>f.1.fdate.ps) | s.11=0) & ((f.2.vdate.ps>f.1.vdate.ps) | s.12=0) & ((f.2.size.ps>f.1.size.ps) | s.10=0) & ((f.2.ver.ps>f.1.ver.ps | (f.2.ver.ps=f.1.ver.ps & f.2.rev.ps>f.1.rev.ps)) | s.14=0) then do
if delete(makepath(makepath(srcp,p.path.nump),name2)) then do
dopus send EXPORT MYID || 2 || p.path.nump || lf || name2
say GetCatStr(35,'[REPL S]') makepath(p.path.nump,name2)
Call DropFile
return
end
else do
reqfiles=reqfiles+1
if s.4=1 then do
dopus send RQPORT MYID || 2 || p.path.nump || lf || name2 || lf || f.1.fdate.ps || lf || f.2.fdate.ps || lf || f.1.vdate.ps || lf || f.2.vdate.ps || lf || f.1.size.ps || lf || f.2.size.ps || lf || f.1.base.ps || lf || f.2.base.ps || lf || f.1.ver.ps || lf || f.2.ver.ps || lf || f.1.rev.ps || lf || f.2.rev.ps || lf || f.1.info.ps || lf || f.2.info.ps || lf || f.1.com.ps || lf || f.2.com.ps || lf || ps
end
else do
dopus send RQPORT MYID || 7 || p.path.nump || lf || name2 || lf || f.1.fdate.ps || lf || f.2.fdate.ps || lf || f.1.vdate.ps || lf || f.2.vdate.ps || lf || f.1.size.ps || lf || f.2.size.ps || lf || f.1.base.ps || lf || f.2.base.ps || lf || f.1.ver.ps || lf || f.2.ver.ps || lf || f.1.rev.ps || lf || f.2.rev.ps || lf || f.1.info.ps || lf || f.2.info.ps || lf || f.1.com.ps || lf || f.2.com.ps || lf || ps
end
say GetCatStr(46,'[ASKe S]') makepath(p.path.nump,name2)
return
end
end
end
end
/* Both file exist but none of them is newer */
/* Replacing on on both sides */
if s.3=1 & s.4=1 then do
reqfiles=reqfiles+1
dopus send RQPORT MYID || 3 || p.path.nump || lf || name2 || lf || f.1.fdate.ps || lf || f.2.fdate.ps || lf || f.1.vdate.ps || lf || f.2.vdate.ps || lf || f.1.size.ps || lf || f.2.size.ps || lf || f.1.base.ps || lf || f.2.base.ps || lf || f.1.ver.ps || lf || f.2.ver.ps || lf || f.1.rev.ps || lf || f.2.rev.ps || lf || f.1.info.ps || lf || f.2.info.ps || lf || f.1.com.ps || lf || f.2.com.ps || lf || ps
say GetCatStr(47,'[ASK ]') makepath(p.path.nump,name2)
return
end
/* Replacing on on Destination */
if s.4=1 then do
reqfiles=reqfiles+1
dopus send RQPORT MYID || 4 || p.path.nump || lf || name2 || lf || f.1.fdate.ps || lf || f.2.fdate.ps || lf || f.1.vdate.ps || lf || f.2.vdate.ps || lf || f.1.size.ps || lf || f.2.size.ps || lf || f.1.base.ps || lf || f.2.base.ps || lf || f.1.ver.ps || lf || f.2.ver.ps || lf || f.1.rev.ps || lf || f.2.rev.ps || lf || f.1.info.ps || lf || f.2.info.ps || lf || f.1.com.ps || lf || f.2.com.ps || lf || ps
say GetCatStr(48,'[ASK D]') makepath(p.path.nump,name2)
return
end
/* Replacing on on Source */
if s.3=1 then do
reqfiles=reqfiles+1
dopus send RQPORT MYID || 5 || p.path.nump || lf || name2 || lf || f.1.fdate.ps || lf || f.2.fdate.ps || lf || f.1.vdate.ps || lf || f.2.vdate.ps || lf || f.1.size.ps || lf || f.2.size.ps || lf || f.1.base.ps || lf || f.2.base.ps || lf || f.1.ver.ps || lf || f.2.ver.ps || lf || f.1.rev.ps || lf || f.2.rev.ps || lf || f.1.info.ps || lf || f.2.info.ps || lf || f.1.com.ps || lf || f.2.com.ps || lf || ps
say GetCatStr(49,'[ASK S]') makepath(p.path.nump,name2)
return
end
say GetCatStr(50,'[SKIP? ]') makepath(p.path.nump,name2)
Call DropFile
return
end
return
DropFile:
/*say GetCatStr(51,'+DROP +') f.name.ps*/
DROP f.name.ps f.1.size.ps f.2.size.ps f.1.fdate.ps f.2.fdate.ps f.1.crc.ps f.2.crc.ps f.1.vdate.ps f.2.vdate.ps f.1.base.ps f.2.base.ps f.1.ver.ps f.2.ver.ps f.1.rev.ps f.2.rev.ps f.1.info.ps f.2.info.ps f.1.com.ps f.2.com.ps f.path.ps
return
DropDir:
/* Not implemented yet */
return
ParseComment:
crc2=0
vdate2=0
cdate2=0
base2=''
ver2=0
rev2=0
info2=''
com3=''
crc2=LEFT(com2,8)
cdate2=SUBSTR(com2,9,8)
if COMPRESS(crc2,'0123456789ABCDEF') ~='' | COMPRESS(cdate2,'0123456789ABCDEF') ~='' | SUBSTR(com2,17,1)~=' ' then do
return
end
com2=substr(com2,17)
cdate2=x2d(cdate2)
if POS('¸',com2)~=0 then do
parse var com2 ' ' com2 '¸' com3
end
else do
parse var com2 ' ' com2
end
rest=com2
vdate2=0
do while vdate2=0 & POS('(',rest)<POS(')',rest) & POS('(',rest)>0
parse var rest . '(' tdate ')' rest
if length(tdate)=10 then do
if substr(tdate,3,1)='.' & substr(tdate,6,1)='.' then do
q=POS(tdate,com2)
tdate=TRANSLATE(tdate,'0',' ')
com2=OVERLAY(tdate,com2,q,10)
vdate2=DATE('i',substr(tdate,7,4) || substr(tdate,4,2) || substr(tdate,1,2),'s')
end
end
end
if vdate2~=0 then do
info2=substr(rest,2)
a=POS(' ',com2)
e=pos(tdate,com2)-3
q=LASTPOS('.',com2,e)
if q>a then do
a=lastpos(' ',com2,q)
ver2=substr(com2,a+1,q-a-1)
rev2=substr(com2,q+1,e-q)
base2=left(com2,a-1)
end
else do
base2=left(com2,e)
end
end
else do
q=pos('.',com2)
if q~=0 then do
do while lastpos(' ',com2,q)=0
q=pos('.',com2,q+1)
if q=0 then do
base2=com2
return
end
end
a=lastpos(' ',com2,q)+1
e=POS(' ',com2,a)-1
if e=-1 then e=LENGTH(com2)
ver2=substr(com2,a,q-a)
rev2=substr(com2,q+1,e-q)
base2=left(com2,a-2)
info2=substr(com2,e+2)
end
else do
base2=com2
end
end
return
CheckArg:
IF DATATYPE(ID)~='NUM' | DATATYPE(CMD)~='NUM' THEN Call CheckArgFail
IF ID=0 THEN Call CheckArgFail
IF ID=1 & CMD>3 THEN Call CheckArgFail
IF ID=2 & CMD>3 THEN Call CheckArgFail
IF ID=3 & CMD>1 THEN Call CheckArgFail
IF ID=4 & CMD>1 THEN Call CheckArgFail
IF ID=5 & CMD>0 THEN Call CheckArgFail
IF ID=6 & CMD>3 THEN Call CheckArgFail
IF ID>6 THEN Call CheckArgFail
RETURN
CheckArgFail:
address value PORT
dopus request '"' || GetCatStr(18,'Error in') ProgramName || lf || GetCatStr(61,'Port') MYPORT || lf || GetCatStr(52,'Invalid packet received') || lf || 'ID=' || ID || lf || 'CMD=' || CMD || lf || 'ARG=' || ARG || '"' GetCatStr(0,'Abort')
Call CleanUP
exit
CleanUp:
if POS(MYPORT,SHOW('p'))~=0 then do
Call FORBID()
Call ClosePort(MYPORTH)
Call PERMIT()
end
If POS(SSPORT,SHOW('p'))~=0 then do
dopus send SSPORT MYID || 0
end
If POS(SDPORT,SHOW('p'))~=0 then do
dopus send SDPORT MYID || 0
end
If POS(VSPORT,SHOW('p'))~=0 then do
dopus send VSPORT MYID || 0
end
If POS(VDPORT,SHOW('p'))~=0 then do
dopus send VDPORT MYID || 0
end
If POS(RQPORT,SHOW('p'))~=0 then do
dopus send RQPORT MYID || 0
end
If POS(EXPORT,SHOW('p'))~=0 then do
dopus send EXPORT MYID || 0
end
Call CloseCatalog(catalog)
Call Close('CON')
return
Init:
libname = "rexxdossupport.library"
if ~show("L", libname) then do
if ~addlib(libname, 0, -30, 2) then do
say libname "not added!"
exit
end
end
libname = "rexxtricks.library"
if ~show("L", libname) then do
if ~addlib(libname, 0, -30) then do
say libname "not added!"
exit
end
end
libname = "rexxsupport.library"
if ~show("L", libname) then do
if ~addlib(libname, 0, -30) then do
say libname "not added!"
exit
end
end
libname = "locale.library"
if ~show("L", libname) then do
if ~addlib(libname, 0, -30) then do
say libname "not added!"
exit
end
end
ProgramName = "Install_Main.dopus5";
ArgsTemplate = "PORT/A,SRCH/A,DSTH/A,PRGCNT/A,PREFSFILE/A"
lf='0a'x
if strip(arguments) = '?' then do
Call WriteCh(STDOUT, ArgsTemplate || ': ')
pull arguments
end; else nop
if ~ReadArgs(arguments,ArgsTemplate) then do
say Fault(RC,ProgramName)
exit 10
end; else nop
drop arguments
catalog=opencatalog('Install.dopus5.catalog','english',0)
if ~open('CON','CONSOLE:','WRITE') then do
dopus request '"' || GetCatStr(18,'Error in') ProgramName || lf || GetCatStr(61,'Port') MYPORT || lf || GetCatStr(15,'Unable to open') 'CONSOLE:' || '"' GetCatStr(0,'Abort')
call CleanUP
Exit
end
return
ERROR:
HALT:
IOERR:
SYNTAX:
IF RC ~= 0 THEN DO
line=sigl
text=errortext(rc)
dopus request '"' || GetCatStr(18,'Error in') ProgramName || lf || GetCatStr(61,'Port') MYPORT || lf || text || lf || GetCatStr(19,'Line') line || '"' GetCatStr(0,'Abort')
END
else do
dopus request '"' || GetCatStr(18,'Error in') ProgramName || lf || GetCatStr(61,'Port') MYPORT || '"' GetCatStr(0,'Abort')
end
BREAK_C:
BREAK_D:
BREAK_E:
BREAK_F:
Call CleanUP
exit
getcatstr: /* Thank you for this procedure, Edmund */
parse arg msgno,msgstring
if catalog~=0 then
msgstring=getcatalogstr(catalog,msgno,msgstring)
do i=3 to arg()
parse var msgstring fore '%s' aft
msgstring=fore||arg(i)||aft
end
return msgstring